{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <div class="col-sm-12">
                    <!--<div class="layui-form layui-form-item" >-->

                        <!--<div class="layui-input-inline" style="margin-top: 5px;">-->
                            <!--<input type="text"  name="match_start_time" onfocus="wk.lay_date(this);" class="layui-input layer-date search" placeholder="赛事开始时间"/>-->
                        <!--</div>-->

                        <!--<div class="layui-input-inline" style="margin-top: 5px;">-->
                            <!--<input type="text"  name="match_end_time" onfocus="wk.lay_date(this);"  class="layui-input layer-date search" placeholder="赛事结束时间"/>-->
                        <!--</div>-->

                        <!--<div class="layui-input-inline" style="margin-top: 5px;">-->
                            <!--<input type="text"  name="apply_start_time" onfocus="wk.lay_date(this);" class="layui-input layer-date search" placeholder="赛事报名开始时间"/>-->
                        <!--</div>-->

                        <!--<div class="layui-input-inline" style="margin-top: 5px;">-->
                            <!--<input type="text"  name="apply_end_time" onfocus="wk.lay_date(this);"  class="layui-input layer-date search" placeholder="赛事报名结束时间"/>-->
                        <!--</div>-->

                        <!--<div class="layui-col-md6 layui-input-inline" style="margin-top: 5px;">-->
                            <!--<input type="text" id="keyword" class="layui-input search" name="keyword" placeholder="赛事ID/名称"/>-->
                        <!--</div>-->

                        <!--<div class="layui-col-md6 layui-input-inline" style="margin-top: 5px;">-->
                            <!--<select name="match_status" lay-search="">-->
                                <!--<option  value="">全部状态</option>-->
                                <!--<option  value="1">未开始</option>-->
                                <!--<option  value="2">进行中</option>-->
                                <!--<option  value="3">已结束</option>-->
                                <!--<option  value="4">已取消</option>-->
                            <!--</select>-->
                        <!--</div>-->

                        <!--<div class="layui-col-md6 layui-input-inline" style="margin-top: 5px;">-->
                            <!--<select name="match_cate" lay-search="">-->
                                <!--<option  value="">全部比赛</option>-->
                                <!--<option  value="1">帆船</option>-->
                                <!--<option  value="2">赛艇</option>-->
                            <!--</select>-->
                        <!--</div>-->

                        <!--<div class="layui-input-inline" style="margin-top: 5px;">-->
                            <!--<button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>-->
                            <!--<button  class="layui-btn layui-btn-normal" id="empty"  lay-submit="" lay-filter="LAY-search">重置</button>-->
                        <!--</div>-->
                    <!--</div>-->
                </div>
                <!--操作框开始-->
                {if $num < 1}
                <div class="col-sm-12">
                    <div class="input-group" >
                        {if $role == 1}
                        <button class="btn btn-primary" type="button" onclick="wk.href('{:url('sailboatAdd')}');">
                            <i class="fa fa-plus"></i> 发布帆船赛事
                        </button>
                        {/if}
                        {if $role == 2}
                        <button class="btn btn-primary m-l-xs" type="button" onclick="wk.href('{:url('rowingAdd')}');">
                            <i class="fa fa-plus"></i> 发布赛艇赛事
                        </button>
                        {/if}
                        <br>
                        <!--<span style="color:red;margin-top:5px;font-size: 2px">请先添加赛事费用</span>-->
                        <!--<button  class="btn btn-danger m-l-xs" href="javascript:;" data-toggle="dropdown">-->
                            <!--<i class="fa fa-wrench"></i> 批量操作 <span class="caret"></span>-->
                        <!--</button>-->
                        <!--<ul class="dropdown-menu layui-anim layui-anim-upbit" role="menu">-->
                            <!--<li><a href="javascript:;" class="layuiBtn" data-type="getCheckData"><i class="fa fa-trash-o"></i> 批量删除 </a></li>-->
                            <!--<li><a  href="javascript:;" class="layuiBtn" data-type="batchClose"><i class="fa fa-check-circle"></i> 批量关闭订单</a></li>-->
                            <!--<li><a  href="javascript:;" class="layuiBtn" data-type="batchDel"><i class="fa fa-ban"></i> 批量删除订单</a></li>-->
                            <!--<li><a  href="javascript:;" class="layuiBtn" data-type="excelAll"><i class="fa fa-external-link"></i> 批量导出</a></li>-->
                            <!--<li><a  href="javascript:;" class="layuiBtn" data-type="excelAllNoSelect"><i class="fa fa-external-link"></i> 全部导出</a></li>-->
                        <!--</ul>-->
                    </div>
                </div>
                {/if}
                <!--操作框结束-->
            </div>
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="testReload"></table>

                    <!--图片模板-->
                    <!--<script type="text/html" id="imgTpl">-->
                        <!--<img src="{{d.banner_thumb}}" class="img-circle table-img" onerror="this.src='/static/admin/images/head_default.gif'"/>-->
                    <!--</script>-->

                    <!--状态显示模板-->
                    <script type="text/html" id="matchCate">
                        {{# if(d.match_cate == 1){ }}
                        帆船
                        {{# } }}
                        {{# if(d.match_cate == 2){ }}
                        赛艇
                        {{# } }}
                    </script>

                    <script type="text/html" id="matchStatus">
                        {{# if(d.match_status == 1){ }}
                        未开始
                        {{# } }}
                        {{# if(d.match_status == 2){ }}
                        进行中
                        {{# } }}
                        {{# if(d.match_status == 3){ }}
                        已结束
                        {{# } }}
                        {{# if(d.match_status == 4){ }}
                        已取消
                        {{# } }}
                    </script>

                    <!--操作模板-->
                    <script type="text/html" id="opeBar">
                        <a href="javascript:;" onclick="wk.layer_show('生活信息','{:url('matchLife')}?match_id={{d.match_id}}')" class="btn btn-warning btn-xs m-r-xs" title="生活信息">生活信息</a>
                        <a href="javascript:;" onclick="wk.layer_show('临时通知','{:url('matchLs')}?match_id={{d.match_id}}')" class="btn btn-warning btn-xs m-r-xs" title="临时通知">临时通知</a>
                        <a href="javascript:;" onclick="wk.layer_show('官方文件','{:url('matchGf')}?match_id={{d.match_id}}')" class="btn btn-warning btn-xs m-r-xs" title="官方文件">官方文件</a>
                        {{# if(d.match_status == 1) { }}
                        <a href="javascript:;" onclick="wk.href('{:url('matchCancel')}?match_id={{d.match_id}}')" class="btn btn-warning btn-xs m-r-xs" title="取消比赛">取消比赛</a>
                        {{# } }}
                        {{# if(d.match_cate == 1){ }}
                        <a href="javascript:;" onclick="wk.href('{:url('sailboatEdit')}?match_id={{d.match_id}}')" class="btn btn-warning btn-xs m-r-xs" title="编辑">编辑</a>
                        {{# } }}
                        {{# if(d.match_cate == 2){ }}
                        <a href="javascript:;" onclick="wk.href('{:url('rowingEdit')}?match_id={{d.match_id}}')" class="btn btn-warning btn-xs m-r-xs" title="编辑">编辑</a>
                        {{# } }}
                        {{# if(d.match_cate == 1){ }}
                        <a href="javascript:;" onclick="wk.layer_show('起航数据','{:url('sailData')}?match_id={{d.match_id}}')" class="btn btn-warning btn-xs m-r-xs" title="起航数据">起航数据</a>
                        {{# } }}
                        {{# if(d.match_cate == 2){ }}
                        <!--<a href="javascript:;" onclick="wk.href('{:url('rowingData')}?match_id={{d.match_id}}')" class="btn btn-warning btn-xs m-r-xs" title="起航数据">起航数据</a>-->
                        {{# } }}

                        <!--<a href="javascript:;" onclick="wk.layer_show('临时成绩','{:url('lsMark')}?match_id={{d.match_id}}')" class="btn btn-warning btn-xs m-r-xs" title="临时成绩">临时成绩</a>-->
                        <!--<a href="javascript:;" onclick="wk.layer_show('详情','{:url('noticeDetail')}?notice_id={{d.notice_id}}')" class="btn btn-warning btn-xs m-r-xs" title="详情"><i class="fa fa-search">详情</i></a>-->
                        <!--<a href="javascript:;" onclick="wk.confirm('{{d.banner_id}}','{:url('bannerDel')}')" class="btn btn-danger btn-xs m-r-xs" title="删除"><i class="fa fa-trash-o">删除</i></a>-->
                    </script>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
                , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("Match/index")}'
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
//                  {type: 'checkbox', fixed: 'left'}
                  {type:'numbers', width: '', title: '序号'}
//                , {field: 'match_id', width: 80, title: 'ID', align: 'center'}
                , {field: 'match_title', width: '', title: '赛事名称', align: 'center'}
                , {field: 'match_addr', width: '', title: '赛事地点', align: 'center'}
                , {field: 'match_time', width: '', title: '赛事比赛时间', align: 'center'}
                , {field: 'match_apply_time', width: '', title: '赛事报名时间', align: 'center'}
                , {field: 'boat_name', width: '', title: '船型', align: 'center'}
                , {field: 'match_create_time', width: 160, title: '赛事创建时间', align: 'center'}
                , {field: 'match_cate', width: 80, title: '类型', align: 'center', toolbar: '#matchCate'}
                , {field: 'match_status', width: 80, title: '状态', align: 'center', toolbar: '#matchStatus'}
                , {field: 'apply_num', width: 90, title: '报名人数', align: 'center'}
                , {field: 'match_apply_num', width: 90, title: '报到人数', align: 'center'}
                , {field: 'user_username', width: 90, title: '总裁判', align: 'center'}
                , {field: 'zhong', width: '', title: '终点裁判', align: 'center'}
                , {field: 'bianpai', width: '', title: '编排长', align: 'center'}
                , {field: 'zhuren', width: '', title: '仲裁主任', align: 'center'}
                , {field: 'mishu', width: '', title: '仲裁秘书', align: 'center'}
                , {field: 'hexiao', width: '', title: '竞赛检录', align: 'center'}
                , {fixed: 'right', width: 430, title: '操作', align: 'center', toolbar: '#opeBar'}
            ]]
            ,done: function (res, curr, count) {
                $('.img-circle').viewer({
                    url: 'data-original',
                });
            }
        });
        var getIds = function () {
            var ids = [];
            var checkStatus = table.checkStatus('testReload')
                    ,data = checkStatus.data;
            $.each(data,function(index,item){
                ids.push(item['match_id'])
            });
            return ids;
        }
    });
</script>
</body>
</html>